<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport"
	      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>消息订阅与发布</title>
	<script src="index.js"></script>
</head>
<body>

</body>
</html>
<script>
	let pid=pubSub.subscribe('pay',data=>{
		console.log('商家接到了订单',data)
	})
	console.log(pid)
	pubSub.publish('pay',{
		title:'鱼香',
		price:20,
		pos:'三年二班'
	})

	setTimeout(()=>{
		// console.log(token)
		pubSub.unsubscribe(pid)
		console.log(pubSub)
	},5000);
</script>
